#include "selectmenu.h"
#include "ui_selectmenu.h"
#include <QDebug>

SelectMenu::SelectMenu(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SelectMenu)
{
    ui->setupUi(this);
    ui->MenuLevel_2->move(0,100);
    Level2Menu_hide = new QPropertyAnimation(ui->MenuLevel_2,"geometry");
    Level2Menu_hide->setEasingCurve(QEasingCurve::InOutSine);
    Level2Menu_hide->setDuration(400);
    Level2Menu_show = new QPropertyAnimation(ui->MenuLevel_2,"geometry");
    Level2Menu_show->setEasingCurve(QEasingCurve::InOutSine);
    Level2Menu_show->setDuration(400);
}

SelectMenu::~SelectMenu()
{
    delete ui;
}

void SelectMenu::on_level_1_Button_1_clicked()
{
    //显示侧边栏
    if(!Level2Menu_flag)
    {
        Level2Menu_show->setStartValue(QRect(0,100,ui->MenuLevel_2->width(),ui->MenuLevel_2->height()));
        Level2Menu_show->setEndValue(QRect(0,0,ui->MenuLevel_2->width(),ui->MenuLevel_2->height()));
        Level2Menu_show->start();
        ui->level_1_Button_1->setText("down");
        Level2Menu_flag = !Level2Menu_flag;
    }
    else
    {
        Level2Menu_hide->setStartValue(QRect(0,ui->MenuLevel_2->pos().y(),ui->MenuLevel_2->width(),ui->MenuLevel_2->height()));
        Level2Menu_hide->setEndValue(QRect(0,100,ui->MenuLevel_2->width(),ui->MenuLevel_2->height()));
        Level2Menu_hide->start();
        ui->level_1_Button_1->setText("up");
        Level2Menu_flag = !Level2Menu_flag;
    }
}

void SelectMenu::on_testButton_clicked()
{
     qDebug() << "test";
}
